<template>
	<view>
		<view class="bidding">
			<image :src="$util.img(bidding_info.sku_image)" mode="" class="bidding_img"></image>
			<view class="bidding_left">
				<text class="bidding_left_co">{{bidding_info.pintuan_name}}</text>
				<view class="bidding_left_color" >
					<text style="margin-right: 28rpx;" v-for="item  in sku_spec_format">{{item.spec_name}}:{{item.spec_value_name}}</text>
				</view>
				<view class="bidding_left_qian">
					<text>¥ {{bidding_info.price}}</text>
				</view>
			</view>
		</view>

		<view class="bidding_herfer">
			<text>截止时间</text>
			<view class="bidding_herfer_view">
				{{$util.timeStampTurnTime(bidding_info.bidding_end_time)}}
			</view>
		</view>

		<view class="bidding_list">
			<view class="bidding_list_anv" v-for="(box ,index) in bidding_level_rule" :key="index">
				<view class="scroll-view-item">
					<view class="list_heder">
						
						<text>竞标等级{{index+1}}</text>
		
						<view class="bidding_list_ring">
							<radio disabled="true" :checked="selected_index==index?true:false"/>
						</view>
					</view>
					<view class="list_bodyw"></view>
					<view class="PopWindow_dyuag">
						<view class="PopWindow_dyuag_sdad">
							<view class="list_num">数量(件)</view>
							<text class="list_num_dyg">{{box.bidding_num}}</text>
						</view>
						<view class="PopWindow_dyuag_sdad">
							<view class="list_num">成本价(元)</view>
							<text class="list_num_dyg">{{Number(box.cost_price).toFixed(2)}}</text>
						</view>

						<view class="PopWindow_dyuag_sdad">
							<view class="list_num">批发价(元)</view>
							<text class="list_num_dyg">{{Number(box.pintuan_price).toFixed(2)}}</text>
						</view>

						<view class="PopWindow_dyuag_sdad">
							<view class="list_num">成团人数</view>
							<text class="list_num_dyg">{{box.pintuan_num}}</text>
						</view>
					</view>
				</view>
	
					
				</view>
			</view>
						<view class="PopWindow_botton" style="height: 120rpx;">
		</view>
		<view class="bidding_footer">
			<view class="bidding_footer_text">
				<view class="daasdgrg">预期获利<text>￥{{earn_profit}}</text></view>
				<view class="bidding_fooad">竞标金额：<text>￥{{bidding_money}}</text></view>
			</view>
		</view>
	</view>

</template>

<script>
	import mypOne from '@/components/myp-one/myp-one.vue';
	import uniPopup from '@/components/uni-popup/uni-popup.vue';
	import nsSwitch from '@/components/ns-switch/ns-switch.vue';
	export default {
		data() {
			return {
				bidding_info: {},
				enter_id: '',
				bidding_level_rule: {},
				sku_spec_format:{},
				bias: {},
				earn_profit: 0, //获利
				bidding_money: 0, //总金额
				isFocus: false,
				orderCreateData: {
					pay_password: '',
				},
				selected_index:-1,
			}
		},
		components: {
			mypOne,
			uniPopup,
			nsSwitch
		},
		onLoad: function(data) {
			this.enter_id = data.enter_id || '';
		},
		onShow() {
			// 刷新多语言
			this.$langConfig.refresh();
			this.butn();
		},
		
		methods: {
			butn(enter_id) {
				this.$api.sendRequest({
					url: '/platformpintuan/api/pintuanbidding/enterdetail',
					data: {
						enter_id: this.enter_id,
					},
					success: res => {
						if (res.code >= 0) {
							this.bidding_info = res.data.bidding_info
							this.sku_spec_format = JSON.parse(res.data.bidding_info.sku_info.sku_spec_format);
							this.bidding_level_rule = res.data.bidding_info.bidding_level_rule;
							this.selected_index= res.data.enter_info.bidding_level;
							
							var level_info = this.bidding_level_rule[this.selected_index]
							this.earn_profit = ((level_info.pintuan_price - level_info.cost_price) * level_info.bidding_num).toFixed(2)
							this.bidding_money = Number(level_info.bidding_money).toFixed(2);
						}
					}
				})
			},
		}
	}
</script>

<style lang="scss">
	.bidding {
		display: flex;
		margin: 22rpx 30rpx 0 30rpx;
		background-color: #FFFFFF;
		height: 250rpx;

		.bidding_img {
			width: 182rpx;
			height: 182rpx;
			display: flex;
			flex-direction: row;
			margin: 32rpx 0 0 32rpx;

		}

		.bidding_left {
			display: flex;
			flex-direction: column;
			margin: 34rpx 0 0 22rpx;

			.bidding_left_co {
				width: 428rpx;
				height: 68rpx;
				line-height: 40rpx;
				font-size: 28rpx;
				display: flex;
				flex-direction: column;
				font-family: PingFang-SC-Medium;
			}

		.bidding_left_color {
				
			margin: 26rpx 0 0 0;
			color: #909399;
			font-size: 26rpx;
			text{
				display: inline-block;
				
			}
		}

			.bidding_left_qian {
				display: flex;
				flex-wrap: row;
				justify-content: flex-start;
				color: #FF4544;
				font-size: 24rpx;
				margin: 14rpx 0 0 0;
			}
		}
	}

	.bidding_herfer {
		margin: 20rpx 28rpx 0 30rpx;
		background-color: #FFFFFF;
		height: 90rpx;
		display: flex;
		position: relative;

		text {
			margin: 26rpx 0 0 40rpx;
			font-size: 28rpx;
			line-height: 40rpx;
		}

		.bidding_herfer_view {
			height: 28rpx;
			position: absolute;
			top: 20rpx;
			right: 36rpx;
		}
	}

	.bidding_list {
		margin: 0 28rpx 0 28rpx;

		.bidding_list_anv {
			width: 100%;

			.scroll-view-item {
				height: 224rpx;
				width: 100%;
				margin-top: 20rpx;
				background-color: #FFFFFF;

				.list_heder {
					color: #000000;
					font-size: 30rpx;
					font-weight: 500;
					display: flex;
					justify-content: row;
					padding: 20rpx 0 0 31rpx;
				}

				.bidding_list_ring {
					position: absolute;
					right: 80rpx;
				}

				.list_bodyw {
					display: inline-block;
					height: 2rpx;
					background-color: #EEEEEE;
					display: flex;
					justify-content: center;
					margin: 29rpx 34rpx 0 30rpx;
				}

				.PopWindow_dyuag {
					display: flex;
					justify-content: flex-start;
					align-items: flex-start;
					align-content: space-between;

					.PopWindow_dyuag_sdad {
						width: 35%;

						.list_num {
							margin: 16rpx 0 0 30rpx;
							color: #909399;
							font-size: 24rpx;
						}

						.list_num_dyg {
							margin-left: 26rpx;
							text-align: center;
							font-size: 32rpx;
							color: #333333;
							font-weight: 500;
						}
					}
				}
			}
		}
	}

	.bidding_footer {
		position: fixed;
		bottom: 0;
		height: 100rpx;
		width: 100%;
		background-color: #FFFFFF;
		font-size: 28rpx;

		.bidding_footer_text {
			display: flex;
			justify-content: flex-start;
			align-items: flex-start;
			margin: 32rpx 0 0 30rpx;

			.daasdgrg {
				font-size: 28rpx;
				height: 26rpx;
				font-weight: 300;

				text {
					margin-left: 20rpx;
					color: #FF4544;

				}
			}

			.bidding_fooad {
				margin-left: 14%;

				text {
					color: #FF4544;
					font-size: 28rpx;
				}
			}

			button {
				width: 184rpx;
				height: 60rpx;
				background-color: #FF4544;
				color: #FFFFFF;
				line-height: 60rpx;
				position: absolute;
				right: -16rpx;
				top: 24rpx;
			}
		}
		
	}

	.pay-password {
		width: 80vw;
		background: #fff;
		box-sizing: border-box;
		border-radius: 10rpx;
		overflow: hidden;
		padding: 60rpx 40rpx;
		transform: translateY(-200rpx);

		.title {
			font-size: 28rpx;
			text-align: center;
		}

		.tips {
			font-size: 24rpx;
			color: #999;
			text-align: center;
		}

		.btn {
			width: 60%;
			margin: 0 auto;
			margin-top: 30rpx;
			height: 70rpx;
			line-height: 70rpx;
			border-radius: 70rpx;
			color: #fff;
			text-align: center;
			border: 1px solid #ffffff;

			&.white {
				margin-top: 20rpx;
				background-color: #fff !important;
			}
		}

		.password-wrap {
			padding-top: 20rpx;
			width: 90%;
			margin: 0 auto;

			.forget-password {
				margin-top: 20rpx;
				display: inline-block;
			}
		}
	}
</style>
